<script>
  async function sleep(duration) {
    return new Promise((resolve) => {
      setTimeout(() => {
        resolve("时间到");
      }, duration);
    });
  }
</script>

{#await sleep(3000)}
  loading...
{:then res}
  {res}
{/await}
